// user相关业务逻辑
import { IGroupMessageEvent } from '../../interface/bot.interface'
import { getUserInfo } from '../../request/screeps'
import { wrapCommandFn } from '../../utils'
import { Next } from '../app'

/**
 * 查看指定用户的信息
 */
export const lookUser = wrapCommandFn(async (e: IGroupMessageEvent, next: Next) => {
    const res = await getUserInfo(e.args[0].toUpperCase())
    if (res.data.ok) {
        const user = res.data.user
        e.group.sendMsg(`[${user.username}]的信息：\n${JSON.stringify(user)}`)
    }
    next()
})
